<template>
  <el-tabs v-model="$route.path" type="card" @tab-click="clickTab" @tab-remove="removeTab">
    <el-tab-pane label="首页" name="/home"/>
    <el-tab-pane v-for="item in openTab" :label="item.name" :name="item.path" closable></el-tab-pane>
  </el-tabs>
</template>

<script>
export default {
  name:"MyTab",
  data(){
    return{
      openTab: this.$store.state.tabList
    }
  },
  methods:{
    clickTab(item){
      this.$router.push(item.props.name)
    },
    removeTab(item){
      this.$store.commit("delete_tabs", item)
    }
  }
}

</script>

<style scoped>

</style>